﻿@model List<BestTenRoundsListEntry>

@{
    ViewBag.Title = "Bedste 10 runder";
    var today = DateTime.Today;
    var actionName = "BestTenRounds";
}

<div class="page-header">
    <h1><span class="glyphicon glyphicon-tower"></span> @ViewBag.Title</h1>
</div>
<ul class="pagination">
    <li>@Html.ActionLink("i dag", actionName, new { date = today.ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("i går", actionName, new { date = today.AddDays(-1).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("i forgårs", actionName, new { date = today.AddDays(-2).ToString("yyyy-MM-dd") })</li>
    <li>@Html.ActionLink("7 dage siden", actionName, new { date = today.AddDays(-7).ToString("yyyy-MM-dd") })</li>
    @foreach (Season s in ViewBag.Seasonlist)
    {
        <li>@Html.ActionLink(s.Name, actionName, new { date = s.EndDate.ToString("yyyy-MM-dd") })</li>
    }
</ul>

<h2>Stilling @ViewBag.SeasonName</h2>
<hr />
<table class="table table-striped">
    <thead>
        <tr>
            <th class="text-center">#</th>
            <th>Spiller</th>
            <th class="text-right">gns. stbl</th>
            <th class="text-right">runder</th>
            <th class="text-right">min. stbl</th>
            <th class="text-right">max. stbl</th>
            <th class="text-right">gns. brutto</th>
            <th class="text-right"></th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @{
            int prevval = 0;
        }
        @foreach (var item in Model)
        {
            <tr>
                <td class="text-center">
                    @if (item.Position != prevval)
                    {
                        @Html.DisplayFor(modelItem => item.TiedPositionIndicator)@Html.DisplayFor(modelItem => item.Position)
                        prevval = item.Position;
                    }
                </td>
                <td>
                    <span class="hidden-xs hidden-sm">
                        @Html.DisplayFor(modelItem => item.Player.DisplayName)
                    </span>
                    <span class="hidden-md hidden-lg">
                        @Html.DisplayFor(modelItem => item.Player.Initials)
                    </span>
                </td>
                <td class="text-right">
                    <b>@Html.DisplayFor(modelItem => item.AverageStableford)</b>
                </td>
                <td class="text-right">
                    @Html.DisplayFor(modelItem => item.NumberOfRounds)
                </td>
                <td class="text-right">
                    @Html.DisplayFor(modelItem => item.LowestStableford)
                </td>
                <td class="text-right">
                    @Html.DisplayFor(modelItem => item.HighestStableford)
                </td>
                <td class="text-right">
                    @Html.DisplayFor(modelItem => item.AverageBruttoscore)
                </td>
                <td class="text-right"></td>
                <td></td>
            </tr>
        }
    </tbody>
</table>
